<template>
  <a-spin :spinning="confirmLoading">
    <j-form-container :disabled="formDisabled">
      <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
        <a-row>
          <a-col :span="24" >
            <a-form-model-item label="文件id" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="fileId">
              <a-input-number v-model="model.fileId" placeholder="请输入文件id" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="公司名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="companyId">
              <a-input-number v-model="model.companyId" placeholder="请输入公司名称" style="width: 100%" />

              <a-input-number  v-model="model.companyId" placeholder="请输入公司名称" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="接收人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="receiveUser">
              <a-input v-model="model.receiveUser" placeholder="请输入接收人"  ></a-input>
            </a-form-model-item>
          </a-col>
         
        </a-row>
      </a-form-model>
    </j-form-container>
  </a-spin>
</template>

<script>

  import { httpAction, getAction } from '@/api/manage'
  import { validateDuplicateValue } from '@/utils/util'

  export default {
    name: 'HteLibCompanyPushForm',
    components: {
    },
    props: {
      //表单禁用
      disabled: {
        type: Boolean,
        default: false,
        required: false
      }
    },
    data () {
      return {
        model:{
         },
        labelCol: {
          xs: { span: 24 },
          sm: { span: 5 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 },
        },
        confirmLoading: false,
        validatorRules: {
           fileId: [
              { required: true, message: '请输入文件id!'},
           ],
           companyId: [
              { required: true, message: '请输入公司id!'},
           ],
           receiveUser: [
              { required: true, message: '请输入接收人!'},
           ],
           isDel: [
              { required: true, message: '请输入删除标识!'},
           ],
        },
        url: {
          add: "/libraryCompany/hteLibCompanyPush/add",
          edit: "/libraryCompany/hteLibCompanyPush/edit",
          queryById: "/libraryCompany/hteLibCompanyPush/queryById"
        }
      }
    },
    computed: {
      formDisabled(){
        return this.disabled
      },
    },
    created () {
       //备份model原始值
      this.modelDefault = JSON.parse(JSON.stringify(this.model));
    },
    methods: {
      add () {
        this.edit(this.modelDefault);
      },
      edit (record) {
        this.model = Object.assign({}, record);
        this.visible = true;
      },
      submitForm () {
        const that = this;
        // 触发表单验证
        this.$refs.form.validate(valid => {
          if (valid) {
             that.$emit('ok',this.model);
          }
         
        })
      },
    }
  }
</script>